<template>
    <div>
        <van-list  @load="onLoad">
        <van-cell v-for="(item,index) in list" :key="index" :title="item"  size="large">
            <div class="list_1">
                <div class="title_label">
                    <div class="title">{{item.title}}</div>
                    <div class="label">
                        <span>{{item.aut_name}}</span>
                        <span>{{item.comm_count}}评论</span>
                        <span>{{item.pubdate}}</span>
                    </div>
                </div>
                <van-image :src="item.cover.images[0]" v-if="item.cover.images[0]" referrerPolicy="no-referrer"></van-image>
            </div>
        </van-cell>
      </van-list>
    </div>
</template>
<script>
export default {
    props:{
        type:Object,
        require:true,
    },
    data(){
        return {
            list: [],
      loading: true,
      finished: false,
        }
    },
    mounted(){
        console.log(this.channel.id);
    },
    methods:{
        onLoad(){
            let url = `/v1_1/articles?channel_id=${this.channel.id}&timestamp=${this.timestamp || Date.now()}&with_top=1`;
            this.$axios.get(url).then(res=>{
                console.log(res);
                let {results} = res.data;
                this.list.push(...results);
               
        if(results.length){
            this.timestamp = res.data.pre_timestamp;
        }
        this.loading = false;
            })
        }
    }
}
</script>
<style lang="scss">
    
</style>